﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="forget_passwd.aspx.cs" Inherits="ncp.Web.forget_passwd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register Src="uc/search.ascx" TagName="search"  TagPrefix="uc" %>
<%@ Register Src="uc/headTop.ascx" TagName="headTop"  TagPrefix="uc" %>
<%@ Register Src="uc/headLogo.ascx" TagName="headlogo"  TagPrefix="uc" %>
<%@ Register Src="/uc/menu.ascx" TagName="menu"  TagPrefix="uc" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>中国农业信息化服务商</title>
    <link href="css/module.css" rel="stylesheet" type="text/css" />
    <link href="css/page.css" rel="stylesheet" type="text/css" />
    <link href="css/reset.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <!--Head Begin-->
	<!--Head Top-->
<uc:headTop id="headtop" runat="server" />
	<!--Head Logo-->
<uc:headlogo id="headlogo" runat="server" />
	<!--Head Nav-->
<div id="head-nav">
	<div id="head-nav-center">
    	<uc:menu ID="menu" runat="server"/>
        <uc:search id="search" runat="server" />
    </div>
</div>
<!--Head End-->
<div class="bh-space"></div>

	<!--content begin-->
	<div class="bh-p-content">
    	<div class="bh-content">
			 <div class="bh-section">

					<div class="bh-register">
						<div class="bh-title">
							<h3>找回密码</h3>
						</div>

						<div class="bh-con">
							<div class="bh-fl">
								<h4>填写您的用户名：</h4>
								<p class="bh-field">
									<label>用户名：</label>
									<input type="text" class="bh-input-long required email" id="tbaccount"/>
									<span class="msg"></span>
								</p>
								
								<p class="bh-field">
									<label>验证码：</label>
									<input type="text" class="required bh-input-small" id="tbcode"/>
									<img id="checkImage" src="/work/VerificationCode.aspx" width="93" height="25"  alt="验证码"　title="验证码" />
									<span >看不清 <span class="bh-blue bh-udline" style="cursor:pointer;" onclick="onfresh()" id="check" >换一张</span></span>
								</p>
								<div class="bh-btn">
								    <input type="button" class="bh-lr-btn" value="提 交" onclick="onRegister()" id="btnreg"/>
								</div>
							</div>
							<div class="bh-fr">
								<p>想起密码了？  <input name="" type="button" class="btn-login1" value="登录" onclick="window.location.href='/login.html'"/></p>

							</div>
						</div>
					</div>

			 </div>

        </div>
    </div>
	<!--content end-->
	<!--Foot Begin-->
<!--#include file="/uc/footer.htm"-->
<!--Foot End-->
	<!-- foot end -->
    </form>
</body>
</html>
<script type="text/javascript">
    function onRegister() {
        var account = $("#tbaccount").val();
        var code = $("#tbcode").val();
        $("span.msg").text("");
        if (isEmpty("tbaccount")) {
            $("#tbaccount").next("span.msg").text("用户名不能为空！");
            return;
        }
        //验证验证码
        var response = ncp.Web.forget_passwd.VerificationCode(code);
        if (response.value != null) {
            var jsonOBJ = eval(response.value)[0];
            if (!jsonOBJ.isreload) {
                alert("验证码错误");
                onfresh();
                return;
            }
            //注册
            var rep = ncp.Web.forget_passwd.SendEmail(account);
            if (rep.value != null) {
                var json = eval(rep.value)[0];
                alert(json.msg);
                $("#tbaccount,#tbcode").val("");
                onfresh();
            }
        }
    }
    //刷新验证码
    function onfresh() {
        var rand = Math.random() * 1000;
        $("#checkImage").attr("src", "/work/VerificationCode.aspx?" + rand);
    }
    $(function() {
    $("#tbaccount,#tbcode").keypress(function(e) {
            var key = window.event ? e.keyCode : e.which;
            if (key.toString() == "13") {
                onRegister();
                return false;
            }
        });
    });
</script>